AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
--include('entities/base_wire_entity/init.lua')
include( 'shared.lua' )

function ENT:Initialize()

	self.Entity:SetModel( "models/GIMP/Cannon_Acc_FusePlate1.mdl" )
	self.Entity:SetName("Fuse")
	self.Entity:PhysicsInit( SOLID_VPHYSICS )
	self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
	self.Entity:SetSolid( SOLID_VPHYSICS )
	
	self.Entity:SetMaterial("spacebuild/Body4")
    	
	local phys = self.Entity:GetPhysicsObject()
	if (phys:IsValid()) then
		phys:Wake()
		phys:EnableGravity(false)
		phys:EnableDrag(false)
		phys:EnableCollisions(true)
		phys:SetMass( 1 )
	end
	
	self.MCD = 1
	self.CCD = 0
end

function ENT:OnTakeDamage( info )
	if info:GetInflictor() == self || info:GetInflictor() == self.Par then
		return
	end
	
	if self.Par && self.Par:IsValid() then
		self:Scorchy()
	end
end

function ENT:Use( activator, caller )
	
end

function ENT:Touch( ent )
	if ent:IsOnFire() then
		if self.Par && self.Par:IsValid() then
			self:Scorchy()
		end
	end
	
end

function ENT:Scorchy()
	if CurTime() >= self.CCD then
		self.Par:Scorchy()
		self.CCD = CurTime() + self.MCD
	end
end